<metro:Flyout x:Class="ConverterSystems.Workstation.Views.SettingsFlyout"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:data="clr-namespace:ConverterSystems.Workstation.Data"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
              xmlns:metro2="clr-namespace:MahApps.Metro;assembly=MahApps.Metro"
              xmlns:v="clr-namespace:ConverterSystems.Workstation.Views"
              xmlns:vm="clr-namespace:ConverterSystems.Workstation.ViewModels"
              Width="346"
              Background="{DynamicResource HighlightBrush}"
              FontSize="14.667"
              Foreground="{DynamicResource IdealForegroundColorBrush}"
              Header="{Binding Source={Localization:Translate Word=Settings}}"
              d:DataContext="{d:DesignInstance Type=vm:ShellViewModel}"
              d:DesignHeight="600"
              mc:Ignorable="d">

    <metro:Flyout.Resources>
        <data:ThemeToBrushConverter x:Key="ThemeToBrushConverter" />
        <data:ThemeToStringConverter x:Key="ThemeToStringConverter" />
        <data:AccentToBrushConverter x:Key="AccentToBrushConverter" />
    </metro:Flyout.Resources>
    <metro:Flyout.CommandBindings>
        <CommandBinding Command="BrowseBack" Executed="OnBrowseBackExecuted" />
    </metro:Flyout.CommandBindings>

    <ScrollViewer>
        <StackPanel Margin="0">
            <Button Command="v:Shell.SignIn"
                    Content="{Binding Source={Localization:Translate Word=SignIn}}"
                    FontSize="26.667"
                    FontWeight="Light"
                    Padding="25,1"
                    Style="{DynamicResource TextButtonStyle}" />
            <TextBlock Margin="25,10"
                       Style="{DynamicResource SubheaderTextStyle}"
                       Text="{Binding Source={Localization:Translate Word=Theme}}" />
            <ListView Height="120"
                      Margin="25,5"
                      Background="Transparent"
                      BorderThickness="0"
                      ItemsSource="{Binding AppThemes}"
                      ScrollViewer.VerticalScrollBarVisibility="Disabled"
                      SelectedItem="{Binding SelectedTheme}">
                <ListView.Resources>
                    <DataTemplate DataType="{x:Type metro2:AppTheme}">
                        <Rectangle Width="28"
                                   Height="28"
                                   Margin="3"
                                   Fill="{Binding Converter={StaticResource ThemeToBrushConverter},
                                                  Mode=OneWay}"
                                   Stroke="Black"
                                   ToolTip="{Binding Converter={StaticResource ThemeToStringConverter},
                                                     Mode=OneWay}" />
                    </DataTemplate>
                </ListView.Resources>
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
            </ListView>
            <TextBlock Margin="25,10"
                       Style="{DynamicResource SubheaderTextStyle}"
                       Text="{Binding Source={Localization:Translate Word=Accent}}" />
            <ListView Height="120"
                      Margin="25,5"
                      Background="Transparent"
                      BorderThickness="0"
                      ItemsSource="{Binding Accents}"
                      ScrollViewer.VerticalScrollBarVisibility="Disabled"
                      SelectedItem="{Binding SelectedAccent}">
                <ListView.Resources>
                    <DataTemplate DataType="{x:Type metro2:Accent}">
                        <Rectangle Width="28"
                                   Height="28"
                                   Margin="3"
                                   Fill="{Binding Converter={StaticResource AccentToBrushConverter},
                                                  Mode=OneWay}"
                                   Stroke="Black"
                                   ToolTip="{Binding Name,
                                                     Mode=OneWay}" />
                    </DataTemplate>
                </ListView.Resources>
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
            </ListView>
            <Button Command="v:Shell.About"
                    Content="{Binding Source={Localization:Translate Word=About}}"
                    FontSize="26.667"
                    FontWeight="Light"
                    Padding="25,1"
                    Style="{DynamicResource TextButtonStyle}" />
        </StackPanel>
    </ScrollViewer>
</metro:Flyout>
